from sanic import Sanic,Blueprint
from sanic.response import json,html
from sanic_jinja2 import Environment,PackageLoader

env = Environment(loader=PackageLoader(__name__,package_path="templates"))

from controller import order,user,category,post
app = Sanic(__name__)

app.blueprint(post.rt)
app.blueprint(category.rt)
app.blueprint(order.rt)
app.blueprint(user.rt)

@app.get("/")
def handle(req):
    tm = env.get_template("home/index.html")
    content = tm.render()
    return html(content)

app.static("/", "./templates/")
if __name__ == "__main__":
    app.run(host="0.0.0.0",port=9999,auto_reload=True,debug=False,access_log=False)
